<!DOCTYPE html>
<html lang="zh-cmn-Hans">
	<head>
		<title>文件上传</title>
		<meta charset="UTF-8" />
		<link rel="stylesheet" href="../../lib/bootstrap/css/bootstrap.min.css" />
		<link rel="stylesheet" href="../../lib/font-awesome-4.0.3/css/font-awesome.min.css" />
		<style>
			html, body {
				height: 100%;
			}
			.container {
				width: 350px;
				margin-left: auto;
				margin-right: auto;
			}
			.title {
				margin-left: auto;
				margin-right: auto;
				height: 100px;
				line-height: 100px;
				width: 100%;
				font-size: 32px;
				text-align: center;
				color: #47a447;
			}
			.file-upload {
				width: 100%;
			}
			.file-upload i {
				font-size: 125px;
				display: block;
				height: 150px;
				line-height: 150px;
				width: 100%;
				text-align: center;
			}
			.file-upload i:hover {
				color: #3276b1;
			}
		</style>
	</head>
	<body style="background-color: #fff!important;">
		<div class="container">
			<div class="title">
				<i class="glyphicon glyphicon-remove-sign"></i>
				<span>文件上传失败</span>
			</div>
			<form id="form" method="post" enctype="multipart/form-data" action="../../project/upload.koala" style="margin-left: 5%;margin-right: 5%;">
				<div class="content">
					<div class="file-upload">
						<i class="fa fa-cloud-upload" id="fileImg"></i>
						<input id="file" name="file" type="file" style="display: none;"/>
					</div>
					<button type="button" class="btn btn-primary btn-block" id="uploadBtn">
						重新上传
					</button>
					<input type="hidden" id="timestamp" name="timestamp">
					</input>
				</div>
			</form>
		</div>
		<script type="text/javascript" src="../../lib/jquery-1.8.3.min.js" ></script>
		<script type="text/javascript" src="../../lib/bootstrap/js/bootstrap.min.js" ></script>
		<script type="text/javascript" src="../../lib/koala-ui.plugin.js" ></script>
		<script>
			$(function() {
				var container = $('.container');
				var file = $('#file');
				var fileImg = $('#fileImg');
				fileImg.on('click', function(){
					file.click();
				});
				var uploadBtn = $('#uploadBtn');
				uploadBtn.on('click', function() {
					var fileName = $('#file').val();
					if (fileName.length == 0) {
						$('body').message({
							type : 'warning',
							content : '请选择要上传的文件!'
						});
						return;
					}
					$('#timestamp').val(new Date().getTime());
					window.parent.importProject.timestamp = $('#timestamp').val();
					window.parent.importProject.fileName = fileName;
					window.parent.importProject.itemPage.data('koala.loader', null).loader({
						title : '正在上传文件...'
					});
					window.parent.importProject.baseInfo = null;
					fileImg.css('visibility', 'hidden');
					$(this).css('visibility', 'hidden');
					$('#form').submit();
				});
			})
		</script>
	</body>
</html>